/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Control;

import java.util.EventListener;

/**
 *
 * @author Gustavo Buzogany Eboli
 */
public class ButtonController implements EventListener {

    private GameController gc;

    /**
     * Metodo construtor
     * @param gc
     */
    public ButtonController(GameController gc){
        this.gc = gc;
    }
    /**
     * Atribui o GameController
     * @param gc
     */
    public void setGameController(GameController gc){
        this.gc = gc;
    }

    /**
     * Evento de clique
     * @param evt
     */
    public void click(ButtonEvent evt){
        String nome = evt.origin.getName();
        if(nome.equals("exit")){
            System.exit(0);
        } else if(nome.equals("newGame")){
            gc.newGame();
        } else if(nome.equals("saveGame")){
            gc.saveScreen();
        } else if(nome.equals("loadGame")){
            gc.loadScreen(0);
        } else if(nome.equals("loadGameIngame")){
            gc.loadScreen(1);
        } else if(nome.equals("backToPause")){
            gc.backToPause();
        } else if(nome.equals("highscore")){
            gc.showHighscores(false);
        } else if(nome.equals("backToMain")){
            gc.showMainMenu();
        } else if(nome.equals("highscoreIngame")){
            gc.showHighscores(true);
        } else if(nome.equals("saveSlot0")){
            gc.saveGame(0);
        } else if(nome.equals("saveSlot1")){
            gc.saveGame(1);
        } else if(nome.equals("saveSlot2")){
            gc.saveGame(2);
        } else if(nome.equals("saveSlot3")){
            gc.saveGame(3);
        } else if(nome.equals("saveSlot4")){
            gc.saveGame(4);
        } else if(nome.equals("resume")){
            gc.switchPaused();
        } else if(nome.equals("loadSlot0")){
            gc.loadGame(0);
        } else if(nome.equals("loadSlot1")){
            gc.loadGame(1);
        } else if(nome.equals("loadSlot2")){
            gc.loadGame(2);
        } else if(nome.equals("loadSlot3")){
            gc.loadGame(3);
        } else if(nome.equals("loadSlot4")){
            gc.loadGame(4);
        }
    }
}
